#define  _CRT_SECURE_NO_WARNINGS
class Solution {
public:
    int halveArray(vector<int>& nums) {
        priority_queue<double> pq(nums.begin(), nums.end());
        double sum = accumulate(nums.begin(), nums.end(), 0.0) / 2.0;
        int count = 0;
        while (sum > 0)
        {
            count++;
            double tmp = pq.top() / 2;
            pq.pop();
            sum -= tmp;
            pq.push(tmp);
        }
        return count;
    }
};